<%@include file="/common/include.jsp" %>
<%@include file="/common/import.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<%@include file="/common/head.jsp" %>
<BODY background="images/fondo_siscaa5.png" style="background-repeat: no-repeat;background-position:left top;">
<f:view>
	<%@include file="/common/menus.jsp" %>
	<h:form styleClass="frm">
	    <rich:tabPanel id="tabpandep" selectedTab="#{loginController.tab}">
        <rich:tab name="tab1" label="Listar Mensajes de ayuda">
            <table width="100%">
            <tr>
            <td>
                <rich:panel style="width:100%">
        		<f:facet name="header"><h:outputText value="Dependencias"/></f:facet>
			        <rich:dataTable width="100%" id="depList" rows="10" columnClasses="col"
			        onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
        			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
			            value="#{loginController.listayudas}" var="deps">
			            <f:facet name="header">
			                <rich:columnGroup>
			                    <h:column>
			                        <h:outputText styleClass="headerText" value="Id" />
			                    </h:column>
			                    <h:column>
			                        <h:outputText styleClass="headerText" value="Descripcion" />
			                    </h:column>
			                </rich:columnGroup>
			            </f:facet>
			            <h:column>
			                <h:outputText value="#{deps.msjid}" />
			            </h:column>
			            <h:column>
			                <h:outputText value="#{deps.msjtit}" />
			            </h:column>
                	<a4j:support reRender="pandep,tabpandep" id="editar"
                    event="onRowClick">
		            	<a4j:actionparam name="descdep" value="#{deps.msjdsc}" assignTo="#{loginController.msj.msjdsc}"/>
		            	<a4j:actionparam name="iddep" value="#{deps.msjid}" assignTo="#{loginController.msj.msjid}"/>
		            	<a4j:actionparam name="dsctit" value="#{deps.msjtit}" assignTo="#{loginController.msj.msjtit}"/>
		            	<a4j:actionparam name="msjdep" value="#{deps.id_dep}" assignTo="#{loginController.msj.id_dep}"/>
		            	<a4j:actionparam name="tabdep" value="tab2" assignTo="#{loginController.tab}"/>
			        </a4j:support>
			        </rich:dataTable>
			        <rich:datascroller align="left" for="depList" maxPages="20"/>
    			</rich:panel>
            </td>
            </tr>
            <tr>
            <td>
            </td>
            </tr>
            </table>
        </rich:tab>
        <rich:tab name="tab2" label="Crear Mensaje de ayuda" >
                <rich:panel id="pandep">
        		<f:facet name="header"><h:outputText value="Ingrese los datos"/></f:facet>
				<table width="100%">
				<tr><td colspan="2">
				<rich:toolBar height="20px" itemSeparator="grid">
			      <rich:toolBarGroup>
			      	  <a4j:commandLink action="#{loginController.limpiarFormMsjAction}" reRender="depList, tabpandep">
			          <h:graphicImage value="images/iconNuevo.png" height="30" width="30"
			          style="border:0"/>
			            <rich:toolTip>
				            <h:outputText value="Nuevo"/>
				        </rich:toolTip>
			          </a4j:commandLink>
			          <a4j:commandLink action="#{loginController.guardarMsj}" reRender="depList, tabpandep">
			          <h:graphicImage value="images/iconGuardar.png" height="30" width="30"
			          style="border:0"/>
			            <rich:toolTip>
				            <h:outputText value="Guardar"/>
				        </rich:toolTip>
			          </a4j:commandLink>
			          <a4j:commandLink action="#{loginController.elimMensaje}" reRender="depList, tabpandep">
			          <h:graphicImage value="images/iconElim.png" height="30" width="30"
			          style="border:0"/>
			            <rich:toolTip>
				            <h:outputText value="Eliminar"/>
				        </rich:toolTip>
			          </a4j:commandLink>
			      </rich:toolBarGroup>
			    </rich:toolBar></td></tr>
			    <tr><td width="20%"><h:outputText value="Ingrese el titulo:"/> </td>
				<td align="left"><h:inputText value="#{loginController.msj.msjtit}" style="width: 300px"/></td></tr>
				<tr><td width="20%"><h:outputText value="Ingrese la descripcion:"/> </td>
				<td align="left"><h:inputText value="#{loginController.msj.msjdsc}" style="width: 300px"/></td></tr>
				<tr><td width="20%"><h:outputText value="Escoja la dependencia:"/> </td>
				<td align="left">
				<h:selectOneMenu id="smiddep" value="#{loginController.msj.id_dep}" disabled="#{loginController.user.badministrador}">
				<f:selectItems value="#{loginController.itemsDeps}"/>
				</h:selectOneMenu></td></tr>
				<tr><td colspan="2">
				<h:outputText value="#{loginController.msjguardarmsj}"
				style="font-family: Arial, Helvetica; color: green;"/></td></tr>
				</table>
    			</rich:panel>
        </rich:tab>
    </rich:tabPanel>
	</h:form>
</f:view>
</BODY>
</HTML>